/**
 * The contents of this file are subject to the OpenMRS Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
package org.openmrs.module.datalogging.model;

import org.openmrs.BaseOpenmrsData;
import org.openmrs.Person;
import org.openmrs.module.datalogging.configuration.Event;

import java.util.HashSet;
import java.util.Set;

public class LogEvent extends BaseOpenmrsData {
	
	private Integer logEventId;
	
	private Person person;
	
	private Event event;
	
	private Set<LogEntry> entries;
	
	/**
	 * Return the value of the logId
	 * 
	 * @return the logId
	 */
	public Integer getLogEventId() {
		return logEventId;
	}
	
	/**
	 * Set the logId with the logId value
	 * 
	 * @param logId the logId to set
	 */
	public void setLogEventId(Integer logEventId) {
		this.logEventId = logEventId;
	}
	
	/**
	 * @see org.openmrs.OpenmrsObject#getId()
	 */
	@Override
	public Integer getId() {
		return getLogEventId();
	}
	
	/**
	 * @see org.openmrs.OpenmrsObject#setId(java.lang.Integer)
	 */
	@Override
	public void setId(Integer id) {
		setLogEventId(id);
	}
	
	/**
	 * Return the value of the person
	 * 
	 * @return the person
	 */
	public Person getPerson() {
		return person;
	}
	
	/**
	 * Set the person with the person value
	 * 
	 * @param person the person to set
	 */
	public void setPerson(Person person) {
		this.person = person;
	}
	
	/**
	 * Return the value of the event
	 * 
	 * @return the event
	 */
	public Event getEvent() {
		return event;
	}
	
	/**
	 * Set the event with the event value
	 * 
	 * @param event the event to set
	 */
	public void setEvent(Event event) {
		this.event = event;
	}
	
	/**
	 * Return the value of the entries
	 * 
	 * @return the entries
	 */
	public Set<LogEntry> getEntries() {
		return entries;
	}
	
	/**
	 * Set the entries with the entries value
	 * 
	 * @param entries the entries to set
	 */
	public void setEntries(Set<LogEntry> entries) {
		this.entries = entries;
	}

	/**
	 * @param entry
	 */
	public void addEntry(LogEntry entry) {
		if (entries == null)
			entries = new HashSet<LogEntry>();
		entries.add(entry);
    }
	
}
